﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess;
using MySql.Data.MySqlClient;

namespace SkynetMySQLAccess
{
    public class DbTypeEnum : IDbTypeEnum
    {
        public int GetTypeEnum(string dbType)
        {
            switch (dbType.Trim().ToUpper())
            {
                case "BIT":
                    return MySqlDbType.Bit.GetHashCode();
                case "BINARY":
                    return MySqlDbType.Binary.GetHashCode();
                case "CHAR":
                    return MySqlDbType.VarChar.GetHashCode();
                case "DATETIME":
                    return MySqlDbType.Timestamp.GetHashCode();
                case "DECIMAL":
                    return MySqlDbType.Decimal.GetHashCode();
                case "FLOAT":
                    return MySqlDbType.Float.GetHashCode();
                case "INT":
                    return MySqlDbType.Int32.GetHashCode();
                case "MONEY":
                    return MySqlDbType.Decimal.GetHashCode();
                case "TEXT":
                    return MySqlDbType.Text.GetHashCode();
                case "TIMESTAMP":
                    return MySqlDbType.Timestamp.GetHashCode();
                case "VARCHAR":
                case "STRING":
                    return MySqlDbType.VarChar.GetHashCode();

            }
            return 0;
        }
    }
}
